<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" isELIgnored="false" %>
<!doctype html>
<html>

	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>会员登录</title>
		<link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.min.css" type="text/css" />
		<script src="${pageContext.request.contextPath}/js/jquery-1.11.3.min.js" type="text/javascript"></script>
		<script src="${pageContext.request.contextPath}/js/bootstrap.min.js" type="text/javascript"></script>
		<!-- 引入自定义css文件 style.css -->
		<link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css" type="text/css" />

		<style>
			body {
				margin-top: 20px;
				margin: 0 auto;
			}
			
			.carousel-inner .item img {
				width: 100%;
				height: 300px;
			}
		</style>
	</head>

	<body>
			<jsp:include page="head.jsp"/>
		</nav>

		<div class="container">
			<div class="row">
        <c:if test="${not empty order}">
				<div style="margin:0 auto; margin-top:10px;width:950px;">
					<strong>我的订单</strong>
					<table class="table table-bordered">

						<c:forEach items="${order}" var="o">
							<tbody>
							<tr class="success">
								<th colspan="3">订单编号:${o.oid}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									<c:if test="${o.state==0}">
										<th>
										<a href="${pageContext.request.contextPath}/order/payForToOrderInfo.do?oid=${o.oid}">付款</a>
							</th>
								<th></th>
									</c:if>
									<c:if test="${o.state==1}">
										  已付款&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
										  <a href="#">确认收货</a>
                    <th>
                    <a href="${pageContext.request.contextPath}/order/refund.do?oid=${o.oid}">退款</a>
                    </th>
                  </c:if>
									<c:if test="${o.state==3}">
										已完成
								</c:if>
								</th>
								<c:if test="${o.state==1}">
									<th>
										<a href="${pageContext.request.contextPath}/search?oid=${o.oid}">物流查询</a>
									</th>
								</c:if>
									<c:if test="${o.state==4}">
                    <th>退款成功</th>
									</c:if>


							</tr>
							<tr class="warning">
								<th>图片</th>
								<th>商品</th>
								<th>价格</th>
								<th>数量</th>
								<th>小计</th>
							</tr>
							<c:forEach items="${o.items}" var="oi">
							<tr class="active">
								<td width="60" width="40%">
									<input type="hidden" name="id" value="22">
									<img src="${pageContext.request.contextPath}/${oi.product.pimage}" width="70" height="60">
								</td>
								<td width="30%">
									<span target="_blank">${oi.product.pname}</span>
								</td>
								<td width="20%">
									￥${oi.product.shop_price}
								</td>
								<td width="10%">
									${oi.count}
								</td>
								<td width="15%">
									<span class="subtotal">￥${oi.subtotal}</span>
								</td>
							</tr>
							</c:forEach>
						</tbody>
							<tr class="success">
								<th colspan="2"></th>
								<th colspan="2">
									订单金额:${o.total}</th>
								<th>
									<a href="${pageContext.request.contextPath}/order/deleteOrders.do?oid=${o.oid}" onclick="return confirm('确认是否删除该订单')">删除订单</a>
								</th>
								</th>
							</tr>

							<tr>
								<th colspan="5" height="5px"></th>
							</tr>
						</c:forEach>
					</table>
				</div>
        </c:if>
        <c:if test="${empty order}">
        <h1><img src="/img/cry.png" width="120px" height="120px">订单为空，快去商城逛逛吧！<a href="${pageContext.request.contextPath}/index.do">前往商城~~~~~~~~</a>
        </c:if>
			</div>
      <!--分页 -->
      <nav aria-label="Page navigation" >
        <ul class="pagination" style="margin-left: 40%">
          <c:if test="${page.isFirstPage == true}">
            <li class="disabled">
              <a href="${pageContext.request.contextPath}/order/findOrderList.do?pageNum=0&oid=${oid}" aria-label="Previous">
                <span aria-hidden="true">首页</span>
              </a>
            </li>
          </c:if>
          <c:if test="${page.isFirstPage != true}">
            <li>
              <a href="${pageContext.request.contextPath}/order/findOrderList.do?pageNum=0&oid=${oid}" aria-label="Previous">
                <span aria-hidden="true">首页</span>
              </a>
            </li>
          </c:if>
          <c:if test="${page.isFirstPage == true}">
            <li class="disabled">
              <a href="${pageContext.request.contextPath}/order/findOrderList.do?pageNum=${page.prePage}&oid=${oid}" aria-label="Previous">
                <span aria-hidden="true">上一页</span>
              </a>
            </li>
          </c:if>
          <c:if test="${page.isFirstPage != true}">
            <li>
              <a href="${pageContext.request.contextPath}/order/findOrderList.do?pageNum=${page.prePage}&oid=${oid}" aria-label="Previous">
                <span aria-hidden="true">上一页</span>
              </a>
            </li>
          </c:if>
          <c:forEach begin="${page.navigateFirstPage}" end="${page.navigateLastPage}" var="item" step="1">
            <c:if test="${item == page.pageNum}">
              <li class="active">
                <a href="${pageContext.request.contextPath}/order/findOrderList.do?pageNum=${item}&oid=${oid}">${item}</a>
              </li>
            </c:if>
            <c:if test="${item != page.pageNum}">
              <li>
                <a href="${pageContext.request.contextPath}/order/findOrderList.do?pageNum=${item}&oid=${oid}">${item}</a>
              </li>
            </c:if>
          </c:forEach>
          <c:if test="${page.isLastPage == true}">
            <li class="disabled">
              <a href="${pageContext.request.contextPath}/order/findOrderList.do?pageNum=${page.nextPage}&oid=${oid}" aria-label="Next">
                <span aria-hidden="true">下一页</span>
              </a>
            </li>
          </c:if>
          <c:if test="${page.isLastPage != true}">
            <li>
              <a href="${pageContext.request.contextPath}/order/findOrderList.do?pageNum=${page.nextPage}&oid=${oid}" aria-label="Next">
                <span aria-hidden="true">下一页</span>
              </a>
            </li>
          </c:if>
          <c:if test="${page.isLastPage == true}">
            <li class="disabled">
              <a href="${pageContext.request.contextPath}/order/findOrderList.do?pageNum=${page.pages}&oid=${oid}" aria-label="Next">
                <span aria-hidden="true">尾页</span>
              </a>
            </li>
          </c:if>
          <c:if test="${page.isLastPage != true}">
            <li>
              <a href="${pageContext.request.contextPath}/order/findOrderList.do?pageNum=${page.pages}&oid=${oid}" aria-label="Next">
                <span aria-hidden="true">尾页</span>
              </a>
            </li>
          </c:if>
        </ul>
      </nav>
      <!-- 分页结束=======================        -->

    </div>

			<jsp:include page="foot.jsp"/>

	</body>

</html>